if (isNull player) exitwith {} ;

//by 略游。不播动画效果最好

//开车加速
fn_Turbo =
{
	_veh = vehicle player;
	_speed = speed _veh;
	_velXM = velocityModelSpace _veh select 0;
	_velYM = velocityModelSpace _veh select 1;
	if(_speed <= 1 || _speed >= 180 || _velXM > _velYM) exitWith {};
	_dir = direction _veh;
	_velX = velocity _veh select 0;
	_velY = velocity _veh select 1;
	_velZ = velocity _veh select 2;
	_speedBoost = 0.1;
	
	_veh setVelocity [(((sin(_dir)) * _speedBoost) + _velX),(((cos(_dir)) * _speedBoost) + _velY),_velZ];
};


dokeyDown={
     private ["_r","_key_delay","_max_height", "_key"] ;
		_key_delay  = 0.1;// 按键间最大时间 
		_max_height = 6.3;// 最大跳跃高度
		// player setvariable ["key",false];// 通过删除/ /开始时启用这条线进行单按键
		_r = false; 
		_key = _this select 1;
		//  HINT STR (_this select 1);// 显示键号
   
		// 各种检查 
		if (player getvariable["key",true] and (_this select 1)  == 46) exitwith {player setvariable["key",false]; [_key_delay] spawn {sleep (_this select 0);player setvariable["key",true]; };_r};
		
		
		if (_key  == 46)then{ //C
			if (player == vehicle player
			&& {speed player > 8 }
			&& {player getvariable ["jump",true]}
			&& {isTouchingGround player} ) then  {
   
			player setvariable["key",true];
			player setvariable ["jump",false];// 禁用跳转

			_height = 600-((load player)*10);// 基于权重降低高度
			//hint str _height;

			// 向右跳
			_vel = velocity player;
			_dir = direction player;
			_speed = 0.4;
			If (_height > _max_height) then {_height = _max_height};// 最大跳跃高度
			player setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)+_height];

			player spawn {sleep 2;_this setvariable ["jump",true]};// RE-ENABLE JUMP
			_r = true;
			};
			
      }else{ //Shift
			if (_key == 42) then {
			   if(vehicle player != player
			   && {speed player > 1}
			   && {vehicle player isKindOf "LandVehicle"}
			   && {isTouchingGround vehicle player}
			   && {driver vehicle player == player}) then {
					call fn_Turbo;
					_r = true;
				};
			};
	  };
     _r
};

waituntil {!(IsNull (findDisplay 46))};
(FindDisplay 46) displayAddEventHandler ["keydown","_this call dokeyDown"];  